﻿//using System;
//using System.Text;
//using System.Collections.Generic;
//using System.Linq;
//using MvcCms.Web.Code;
//using MvcCms.Service.Code.Membership;
//using NUnit.Framework;
//using Rhino.Mocks;
//using MvcContrib.TestHelper;
//using MvcCms.Web.Controllers;
//using MvcCms.Service;
//using MvcCms.Service.Cache;
//using System.Web.Mvc;
//using MvcCms.Data;

//namespace MvcCms.Web.Tests.Controllers
//{
//    /// <summary>
//    /// Summary description for UnitTest1
//    /// </summary>
//    [TestFixture]
//    public class HomeControllerTests
//    {
//        private  HomeController _controller;
//        private  TestControllerBuilder _builder;

//        private  ICmsService cmsService;
//        private  ICacheService cacheService;
//        private  IPortalService portalService;

//        IMembershipWrapper membershipWrapper;
//        Portal currentPortal;
//        ContentPage contentPage;
//        [TestFixtureSetUp]
//        public void Setup()
//        {
//            cmsService = MockRepository.GenerateStub<ICmsService>();
//            cacheService = MockRepository.GenerateStub<ICacheService>();
//            portalService = MockRepository.GenerateStub<IPortalService>();
//            membershipWrapper = MockRepository.GenerateStub<IMembershipWrapper>();

//            _builder = new TestControllerBuilder();
//            _controller = _builder.CreateController<HomeController>(cmsService, cacheService, portalService, membershipWrapper);
//            Language lang=new Language{ LanguageID=1, LanguageName="English"};
//            ContentCategory contentCat = new ContentCategory { Title = "TestTitle" };
//            currentPortal = new Portal { AdminEmail = "", AllowOpenIdRegistration = false, AllowPageWikiHtmlSwitch = false, ContentCategories = null, ContentPages = null, DefaultLanguage = lang, DisplayName = "test" };
//            contentPage = new ContentPage { Body = "TestBody",ContentCategory=contentCat };
//        }
              
//        [Test]
//        public void TestIndexShouldRenderViewIndex()
//        {
//            cacheService.Expect(cr => cr.GetCurrentPortal()).Return(currentPortal);
//            cmsService.Expect(cr => cr.GetPublishedCategoryContentPage(1)).Return(contentPage);
//            cmsService.Expect(cr => cr.ListAltLanguagePages(1)).Return(new List<ContentPage>());
//            ActionResult result=   _controller.Index(null, null, null);
//            Assert.AreSame(_controller.ViewData["SiteName"], currentPortal.DisplayName);
//            Assert.AreEqual(_controller.ViewData["DefaultLangID"], currentPortal.DefaultLanguage.LanguageID);
//            Assert.AreSame(_controller.ViewData["PageContent"], contentPage.Body);
//            Assert.AreSame(_controller.ViewData["userguid"], string.Empty);
//            var model = _controller.ViewData.Model;
//            Assert.IsNotNull(model);
//            result.AssertViewRendered().ForView(string.Empty);
          
//        }

//        [Test]
//        public void TestEditCommentPageShouldRenderViewEditComment()
//        {
//            ContentComment contentcomment = new ContentComment();
//            cmsService.Expect(cr => cr.GetContentComment(1)).Return(contentcomment);

//            ActionResult result = _controller.EditComment(1, string.Empty);

//            Assert.AreSame(_controller.ViewData["PageTitle"], "Edit Comment");
//            var model = _controller.ViewData.Model as ContentComment ;
//            Assert.AreEqual(model, contentcomment);

//            result.AssertViewRendered().ForView("EditComment");

//        }

//        public void TestCommentReplyPageShouldRenderViewCommentReply()
//        {
//            ContentComment contentcomment = new ContentComment();
//            cmsService.Expect(cr => cr.GetContentComment(1)).Return(contentcomment);

//            ActionResult result = _controller.CommentReply(1, string.Empty);

//            Assert.AreSame(_controller.ViewData["PageTitle"], "Reply To Comment");
//            var model = _controller.ViewData.Model as ContentComment ;
//            Assert.AreEqual(model, contentcomment);

//            result.AssertViewRendered().ForView("CommentReply");
//        }        
//    }
//}
